import { request } from '@umijs/max';

export interface MaterialItem {
  id?: number;
  goodsname: string;
  principal: string;
  place: string;
  quantity: number;
  price: number;
  date: string;
}

export const materialList = async () => {
  return request('/api/material');
};

export const addMaterial = async (params?: MaterialItem) => {
  try {
    return await request('/api/material/add', {
      method: 'POST',
      data: params,
    });
  } catch (error) {
    return {
      errorMessage: '失败',
    };
  }
};
